package com.llg.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.llg.model.code.CommonCode;
import com.llg.model.code.PageCode;
import com.llg.model.response.DataResult;
import com.llg.model.response.PageResult;
import com.llg.model.response.ResponseResult;
import com.llg.pojo.ProcessorBrand;
import com.llg.service.ProcessorBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@RestController
@RequestMapping("/processorBrand")
public class ProcessorBrandController {

    @Autowired
    private ProcessorBrandService service;


    //查所有
    @GetMapping("/findAll")
    public PageResult<ProcessorBrand> findAll(){
        return service.findAll();
    }

    //分页搜索查
    @PostMapping("/findList")
    public PageResult<ProcessorBrand> findList(Integer currentPage,Integer pageSize,@RequestBody ProcessorBrand processorBrand){
        return service.findList(currentPage, pageSize, processorBrand);
    }

    //通过id查
    @GetMapping("/{id}")
    public DataResult<ProcessorBrand> findById(@PathVariable("id") Integer id){
        return service.findById(id);
    }

    //增
    @PostMapping("/add")
    public DataResult<ProcessorBrand> add(@RequestBody ProcessorBrand processorBrand){
        return service.add(processorBrand);
    }

    //删
    @GetMapping("/delete/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        return service.delete(id);
    }

    //改
    @PostMapping("/update")
    public ResponseResult update(@RequestBody ProcessorBrand processorBrand){
        return service.update(processorBrand);
    }

}
